package com.aabte.springcloudlearn.feigncustomerdemo.service;

import com.aabte.springcloudlearn.feigncustomerdemo.config.DisableHystrixConfiguration;
import com.aabte.springcloudlearn.feigncustomerdemo.fallback.RetryCustomerFeignServiceFallback;
import com.aabte.springcloudlearn.feigncustomerdemo.fallback.RetryCustomerFeignServiceFallbackFactory;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * 服务重试测试Service类
 * {@link FeignClient#configuration()}属性中配置的是禁用Feign中的Hystrix功能的类
 */
@FeignClient(
        // 指定服务名称
        value = "hello-service",

        // 指定Hystrix的配置类，可通过此类关闭此FeignClient的Hystrix功能
        // configuration = DisableHystrixConfiguration.class,

        // 优先使用fallback属性指定的降级配置
        fallback = RetryCustomerFeignServiceFallback.class,
        fallbackFactory = RetryCustomerFeignServiceFallbackFactory.class)
public interface RetryCustomerFeignService {

    /**
     * 调用服务提供者的重试测试接口
     *
     * @return OK
     */
    @GetMapping(value = "/retry")
    String feignRetry();

}
